package cn.njyd.corejava.thread.myday01;

import javax.swing.plaf.TableHeaderUI;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;

public class CallableDemo05 {
    public static void main(String[] args) {
        Thread t1 = new Thread(new FutureTask<String>(()->{
            for (int i=1;i<=10;i++) {
                TimeUnit.MICROSECONDS.sleep(100);
                System.out.println(Thread.currentThread().getName()+"正在写"+i+"个视频");
            }



            return Thread.currentThread().getName();
        }),"学生A");

        t1.start();

        Thread t2 = new Thread(new FutureTask<String>(()->{
            for(int i=1;i<=10;i++) {
                TimeUnit.MICROSECONDS.sleep(100);
                System.out.println(Thread.currentThread().getName()+"正在写"+i+"个视频");
            }
            return Thread.currentThread().getName();
        }));
        t2.start();

    }
}
